package com.globallogic.jbtask4;

public enum Month {

    JANUARY, FEBRUARY, APRIL, MARCH, MAY, JUNE, 
    JULY, AUGUST, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER;

    public static int getMonthNumber(String month) throws MonthFormatException {
            
        try 
        {
             
            return  Month.valueOf(month.toUpperCase()).ordinal() + 1;

        } catch (IllegalArgumentException e) {
            
            throw new MonthFormatException(month);
            
        }

    }
}
